package com.jxtpro.controller;

import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jxtpro.model.User;
import com.jxtpro.service.UserService;
/**
 * 首页控制器
 * @author x
 *
 */
public class IndexController extends Controller{
	/**
	 * 首页地址1
	 */
	public void index(){
		Page<User> user = UserService.me.paginate(getParaToInt(0, 1), 3);
		setAttr("user",user);
//		render("index.html");
		render("index.jsp");
	}
	/**
	 * 首页地址2
	 */
	public void index2(){
		Page<Record> blog = Db.paginate(1, 10, "SELECT a.name, b.*", "FROM user a LEFT JOIN blog b on a.id = b.au_id where a.id=1");
		setAttr("blog",blog);
//		render("index.html");
		render("index2.jsp");
	}
}
